import { Component,OnInit,ComponentFactoryResolver} from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
import {HttpURLService} from "../../httpURL.service";
/**
 * 数采仪反控服务
 * guopeng
 * 2017.11.27
 */
export class AirPollutant {
  constructor(
    private id : string,//排污企业ID
    private atmospherePollutantCode : string,//排污企业名称
    private atmospherePollutantName : string,//排放口名称
    private atmosphereOriginalPollutantCode : string,//监控点名称
    private atmosphereUnitConcentration :string,//数采仪名称
    private atmosphereUnitDischarge : string,//mn号
    private atmosphereTypeConcentration : string,//监控类型
    private extensionInfo : string//拓展信息
  ){}
}

@Component({
  selector: 'app-collect',
  templateUrl: './collect.component.html',
  styleUrls: ['./collect.component.css']
})
export class CollectComponent implements OnInit {
  private id: string;//排污企业ID
  private atmospherePollutantCode: string;//排污企业名称
  private atmospherePollutantName: string;//排放口名称
  private atmosphereOriginalPollutantCode: string;//监控点名称
  private atmosphereUnitConcentration: string;//数采仪名称
  private atmosphereUnitDischarge: string;//mn号
  private atmosphereTypeConcentration: string;//监控类型

  private list: Array<any>;
  public params; // 保存页面url参数
  public pageSize: any = 5;// 每页数据条数
  public curPage: any = 1;// 当前页码
  public totalNum: any = 0; // 总数据条数
  public totalPage: any = 0;// 总页数
  public url:string = this.httpURLService.getUrl("communication");
  public emisURL:string = this.httpURLService.getUrl("emis");

  constructor(private http: HttpClient, public router: Router,private httpURLService: HttpURLService) {
  }

  getPageData(pageNo) {
    let vm = this;
    vm.curPage = pageNo;
    let atmospherePollutantCode = this.atmospherePollutantCode == undefined ? '' : this.atmospherePollutantCode;
    let atmospherePollutantName = this.atmospherePollutantName == undefined ? '' : this.atmospherePollutantName;
    let current = pageNo;
    this.http.get(this.emisURL+'/dataAcq/queryDataAcqListByPage?atmospherePollutantCode=' + atmospherePollutantCode + '&atmospherePollutantName=' + atmospherePollutantName + '&current=' + current).subscribe(data => {
      this.totalNum = data['total'];
      this.totalPage = data['pages'];
      this.curPage = data['current']
      this.pageSize = data['size'];
      this.list = data['records'];
    })
  }
  listMessage(info:any){
    let polluterName = info.polluterName== undefined ? '' : info.polluterName ;
    let monitorType = info.monitorType== undefined ? '' : info.monitorType;
    let mn = info.mn== undefined ? '' : info.mn;
    let current = this.curPage;
    this.http.get(this.emisURL+'/dataAcq/queryDataAcqListByPage?polluterName='+polluterName+'&monitorType='+monitorType+'&mn='+mn).subscribe(data => {
      this.totalNum = data['total'];
      this.totalPage = data['pages'];
      this.curPage = data['current']
      this.pageSize = data['size'];
      this.list  = data['records'];
    })
  }
	onstructor(){ }
	ngOnInit() {
    this.http.get(this.emisURL +'/dataAcq/queryDataAcqListByPage').subscribe(data => {
      this.totalNum = data['total'];
      this.totalPage = data['pages'];
      this.curPage = data['current']
      this.pageSize = data['size'];
      this.list = data['records'];
    })
  }
}
export class dataAcq {
  constructor(
    private id : string,//
    private dataAcqName : string,//数采仪名
    private mn : string,//mn
    private monitorName : string,//监控名称
    private monitorType :string,//监控类型
    private polluterId : string,//企业ID
    private polluterName : string,//企业名
    private portName : string,//排口名
    private extensionInfo : string//拓展信息
  ){}
}







